#ifndef CARTOGRAPHER_MAPPING_INTERNAL_2D_LOCAL_SLAM_RESULT_2D_H_
#define CARTOGRAPHER_MAPPING_INTERNAL_2D_LOCAL_SLAM_RESULT_2D_H_

#include "cartographer/mapping/internal/local_slam_result_data.h"
#include "cartographer/mapping/internal/submap_controller.h"
#include "cartographer/mapping/trajectory_builder_interface.h"

namespace cartographer
{
    namespace mapping
    {

        class LocalSlamResult2D : public LocalSlamResultData
        {
        public:
            LocalSlamResult2D(const std::string &sensor_id, const mapping::proto::LocalSlamResultData local_slam_result_data,
                              SubmapController<mapping::Submap2D> *submap_controller)
                : LocalSlamResultData(sensor_id, common::FromUniversal(local_slam_result_data.timestamp()))
                , sensor_id_(sensor_id)
                , local_slam_result_data_(local_slam_result_data)
                , submap_controller_(submap_controller)
            {
            }

            void AddToTrajectoryBuilder(TrajectoryBuilderInterface *const trajectory_builder) override;
            void AddToPoseGraph(int trajectory_id, PoseGraph *pose_graph) const override;

        private:
            const std::string sensor_id_;
            const mapping::proto::LocalSlamResultData local_slam_result_data_;
            SubmapController<mapping::Submap2D> *submap_controller_;
        };

    } // namespace mapping
} // namespace cartographer

#endif // CARTOGRAPHER_MAPPING_INTERNAL_2D_LOCAL_SLAM_RESULT_2D_H_
